package org.example.spring_annotation.controller;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "MyServlet", value = "/ttt")
@MultipartConfig(fileSizeThreshold = 1024 * 102, maxFileSize = 1024 * 1024 * 5, maxRequestSize = 1024 * 1024 * 5 * 5)
public class MyServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.getWriter().println("need post");
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.getWriter().println("he he MyServlet");
        Part pic = request.getPart("pic");
        pic.write("/Users/yaclty/temp/exe/a.jpg");
        response.getWriter().println("success");
    }
}
